/*
 * @Author: Sam
 * @Date: 2020-11-20 11:33:22
 * @LastEditTime: 2021-05-07 16:16:37
 * @LastEditors: Sam
 * @Description: 公共数据
 * @FilePath: \resourcesf:\thework\tofba-client\src\store\modules\public.js
 * @
 */
import { initData } from '@/api/public'

const state = {
  publicData: '',
}

const mutations = {
  GET_PUBLIC_DATA: (state, data) => {
    state.publicData = data
  }
}

const actions = {
  getPublicData ({ commit }) {
    return new Promise((resolve, reject) => {
      initData({})
        .then(response => {
          commit('GET_PUBLIC_DATA', response)
          resolve()
        })
        .catch(error => {
          reject(error)
        })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

